#include <QFileDialog>
#include "mainwindow.h"
#include "ui_mainwindow.h"


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

	m_importForm = NULL;
	m_queryForm = NULL;
	m_dbconfigForm = NULL;
}

MainWindow::~MainWindow()
{
	if (ui) {
		delete ui;
		ui = NULL;
	}

	if (m_importForm) {
		m_importForm->close();
		delete m_importForm;
		m_importForm = NULL;
	}

	if (m_queryForm) {
		m_queryForm->close();
		delete m_queryForm;
		m_queryForm = NULL;
	}

	if (m_dbconfigForm) {
		m_dbconfigForm->close();
		delete m_dbconfigForm;
		m_dbconfigForm = NULL;
	}
}

void MainWindow::on_actionImportData_triggered()
{
	if (NULL == m_importForm)
		m_importForm = new importForm();
	m_importForm->show();
}

void MainWindow::on_actionQueryData_triggered()
{
	if (NULL == m_queryForm)
		m_queryForm = new queryForm();
	m_queryForm->show();
}

void MainWindow::on_actionDbConfig_triggered()
{
	if (NULL == m_dbconfigForm)
		m_dbconfigForm = new dbconfigForm();
	m_dbconfigForm->show();
}
